package com.hzit.config;

import com.hzit.controller.HelloController;
import com.hzit.pojo.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.filter.HiddenHttpMethodFilter;

import javax.servlet.annotation.WebServlet;
import java.time.chrono.HijrahDate;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@Configuration
@Import(User.class)     // 导入到容器中的名字是类的完全限定名
@ConditionalOnBean(HelloController.class)
public class MyConfig {
	// 修改表单提交的restful风格为适合put和delete（表单只能用get,post提交）
	@Bean
	public HiddenHttpMethodFilter methodFilter(){
		HiddenHttpMethodFilter filter = new HiddenHttpMethodFilter();
		filter.setMethodParam("_m");
		return filter;
	}

	@Bean(name = "user01")
	public User user(){
		return new User();
	}
}
